<?php
/*
WHM Dynamic DNS Updater v2.1.0
By Silas Montgomery
Website: http://reticent.net
Email: nomsalis@reticent.net)
*/

// Classes
require_once("class.ZoneUpdater.php");
require_once("class.Scraper.php");
require_once("class.Logger.php");

// Configuration
require_once("whmDynDns.config.php");

// Logic
try
{
	$scraper = new Scraper();
	$scraper->SetUrls($websites);
	//if($ip = $scraper->GetIp())
	//{

		//$ipmendico = file_get_contents('https://buzeb.bahcesehir.edu.tr/fen/whm/tmp/data.txt');
		
		$file = fopen("https://buzeb.bahcesehir.edu.tr/fen/whm/tmp/data.txt", "r") or exit("Unable to open file!");
		//Output a line of the file until the end is reached
		while(!feof($file))
		{
			$ipmendico = fgets($file);
		}
		fclose($file);
		
		$updater = new ZoneUpdater();
        $updater->SetUsername($username);
        $updater->SetPassword($password);
        $updater->SetUrl($whmUrl);
		$updater->SetIp($ipmendico);
		$updater->SetZones($zones);
		$updater->Update();
	//}
}
catch(exception $e)
{
	Logger::Write($e);
}
?>
